<!--iframe读取页面需要同源，预览文件大概需要服务器响应头设置，此解决方案废弃-->
<template>
  <div style="overflow-y: scroll;-webkit-overflow-scrolling:touch;width:100%;height:100%;border: 1px solid #ccc;">
    <iframe id="i1" src="http://localhost:8080/#/puzzle" frameborder="0" scrolling='no'
            style="min-width: 100%;width:100%;min-height:366px;"></iframe>
  </div>
</template>

<script>
export default {
  name: 'wordReader',
  data () {
    return {
      html: null
    }
  },
  mounted () {
    this.setIframeHeight('i1')
    setTimeout(this.test, 5000)
  },
  methods: {
    setIframeHeight (id) {
      try {
        let iframe = document.getElementById(id)
        if (iframe.attachEvent) {
          iframe.attachEvent('onload', function () {
            iframe.height = iframe.contentWindow.document.documentElement.scrollHeight
          })
          return
        } else {
          iframe.onload = function () {
            iframe.height = iframe.contentDocument.body.scrollHeight
          }
          return
        }
      } catch (e) {
        console.warn('setIframeHeight Error')
      }
    }
  }

}
</script>

<style scoped>
</style>
